home *** CD-ROM | disk | FTP | other *** search
/ Amiga Developer CD 2.1 / Amiga Developer CD v2.1.iso / Extras / IFF / IFF_Forms / ILBM.CLUT.doc < prev    next >
Encoding:
Text File  |  1993-03-01  |  3.4 KB  |  108 lines

  1. Color Lookup Table chunk
  2.  
  3.  
  4. amiga.dev/iff message 1527
  5. ----------
  6. TITLE: CLUT IFF chunk proposal
  7.  
  8. "CLUT" IFF 8-Bit Color Look Up Table
  9.  
  10. Date:    July 2, 1989
  11. From:    Justin V. McCormick
  12. Status:    Public Proposal
  13. Supporting Software:  FG 2.0 by Justin V. McCormick for PP&S
  14.  
  15.  
  16. Introduction:
  17.  
  18.   This memo describes the IFF supplement for the new chunk "CLUT".
  19.  
  20. Description:
  21.  
  22.   A CLUT (Color Look Up Table) is a special purpose data module
  23. containing table with 256 8-bit entries.  Entries in this table
  24. can be used directly as a translation for one 8-bit value to
  25. another.
  26.  
  27. Purpose:
  28.  
  29.   To store 8-bit data look up tables in a simple format for
  30. later retrieval.  These tables are used to translate or bias
  31. 8-bit intensity, contrast, saturation, hue, color registers, or
  32. other similar data in a reproducable manner.
  33.  
  34. Specifications:
  35.  
  36. /* Here is the IFF chunk ID macro for a CLUT chunk */
  37. #define ID_CLUT MakeID('C','L','U','T')
  38.  
  39. /*
  40.  * Defines for different flavors of 8-bit CLUTs.
  41.  */
  42. #define CLUT_MONO    0L    /* A Monochrome, contrast or intensity LUT */
  43. #define CLUT_RED    1L    /* A LUT for reds         */
  44. #define CLUT_GREEN    2L    /* A LUT for greens         */
  45. #define CLUT_BLUE    3L    /* A LUT for blues         */
  46. #define CLUT_HUE    4L    /* A LUT for hues         */
  47. #define CLUT_SAT    5L    /* A LUT for saturations     */
  48. #define CLUT_UNUSED6    6L    /* How about a Signed Data flag */
  49. #define CLUT_UNUSED7    7L    /* Or an Assumed Negative flag    */
  50.  
  51. /* All types > 7 are reserved until formally claimed */
  52. #define CLUT_RESERVED_BITS 0xfffffff8L
  53.  
  54. /* The struct for Color Look-Up-Tables of all types */
  55. typedef struct
  56. {
  57.   ULONG type;        /* See above type defines */
  58.   ULONG res0;        /* RESERVED FOR FUTURE EXPANSION */
  59.   UBYTE lut[256];    /* The 256 byte look up table */
  60. } ColorLUT;
  61.  
  62.  
  63. CLUT Example:
  64.  
  65.   Normally, the CLUT chunk will appear after the BMHD of an FORM
  66. ILBM before the BODY chunk, in the same "section" as CMAPs are
  67. normally found.  However, a FORM may contain only CLUTs with no
  68. other supporting information.
  69.  
  70.   As a general guideline, it is desirable to group all CLUTs
  71. together in a form without other chunk types between them.
  72. If you were using CLUTs to store RGB intensity corrections, you
  73. would write three CLUTs in a row, R, G, then B.
  74.  
  75.   Here is a box diagram for a 320x200x8 image stored as an IFF ILBM
  76. with a single CLUT chunk for intensity mapping:
  77.  
  78.           +-----------------------------------+   
  79.           |'FORM'        64284            |     FORM 64284 ILBM
  80.           +-----------------------------------+   
  81.           |'ILBM'                    |     
  82.           +-----------------------------------+   
  83.           | +-------------------------------+ |   
  84.           | | 'BMHD'    20          | |     .BMHD 20
  85.           | | 320, 200, 0, 0, 8, 0, 0, ...  | |   
  86.           | | ------------------------------+ |   
  87.           | | 'CLUT'    264              | |     .CLUT 264
  88.           | | 0, 0, 0; 32, 0, 0; 64,0,0; .. | |   
  89.           | +-------------------------------+ |   
  90.           | +-------------------------------+ |   
  91.           | |'BODY'        64000     | |     .BODY 64000
  92.           | |0, 0, 0, ...              | |   
  93.           | +-------------------------------+ |   
  94.           +-----------------------------------+   
  95.  
  96.  
  97. Design Notes:
  98. -------------
  99.  
  100.   I have deliberately kept this chunk simple (KISS) to
  101. facilitate implementation.  In particular, no provision is made
  102. for expansion to 16-bit or 32-bit tables.  My reasoning is that
  103. a 16-bit table can have 64K entries, and thus would benefit from
  104. data compression.  My suggestion would be to propose another
  105. chunk or FORM type better suited for large tables rather than
  106. small ones like CLUT.
  107.  
  108.